﻿Imports System.IO

Module SearchFormModule

    Function enumImages() As List(Of String)
        Dim filescontainer As New System.IO.DirectoryInfo(MainPath)
        Dim possibleExtensions As New List(Of String) From {".jpg", ".jpeg", ".bmp", ".gif", ".png"}
        Dim retval As New List(Of String)
        For Each File In filescontainer.GetFiles
            If possibleExtensions.Contains(File.Extension) Then
                retval.Add(File.FullName)
            End If
        Next
        Return retval
    End Function



    Function enumImages(ByVal Datum As String) As List(Of ImageEnumType)
        Dim filescontainer As New System.IO.DirectoryInfo(MainPath)
        Dim possibleExtensions As New List(Of String) From {".jpg", ".jpeg", ".bmp", ".gif", ".png"}
        Dim retval As New List(Of ImageEnumType)
        For Each File In filescontainer.GetFiles

            If possibleExtensions.Contains(File.Extension) Then
                Dim nn = Split(File.Name, "-")(0)
                Dim no = Replace(Split(File.Name, "-")(1), ".", ":")
                If nn = Datum Then
                    Dim ntype As New ImageEnumType
                    With ntype
                        .Name = File.Name
                        .Source = File.Name
                        .Uhrzeit = no
                    End With
                    retval.Add(ntype)
                End If
            End If
        Next
        Return retval
    End Function
End Module

Public Class ImageEnumType
    Public Property Name As String
    Public Property Source As String
    Public Property Uhrzeit As String
End Class